window.onload = function() {

    var submit = document.getElementById("check");
    var username = document.getElementById("username");
    var password = document.getElementById("password");

    var aP = document.getElementsByClassName('msg')
    var username_msg = aP[0];
    var password_msg = aP[1];

    username.onblur = function() {
        username_msg.style.display = "block";
        username_msg.innerHTML = '<i>&nbsp</i>';
    }

    password.onblur = function() {
        password_msg.style.display = "block";
        password_msg.innerHTML = '<i>&nbsp</i>';
    }

    submit.onclick = function(form) {
        if (username.value == '' || username.value == null) {
            username_msg.innerHTML = '<i class="err">用户名不能为空</i>';
            return false;
        } else if (password.value == '' || password.value == null) {
            password_msg.innerHTML = '<i class="err">密码不能为空</i>';
            return false;
        } else {
            return true;
        }
    }

    unlogin();

}